package hr.sting.droidorm.types;

import android.content.ContentValues;
import android.database.Cursor;

/**
 * @author mstipanov
 * @since 11.07.2010. 20:41:09
 */
public class StringOrmTypeMapper extends AbstractOrmTypeMapper implements OrmTypeMapper {
    private OrmTypeMapper next;

    public StringOrmTypeMapper(OrmTypeMapper next) {
        super(next);
    }

    @Override
    protected boolean isForMe(Class<?> type) {
        return type.isAssignableFrom(String.class);
    }

    @Override
    protected void actualPutContentValue(ContentValues contentValues, String columnName, Class<?> type, Object o) {
        contentValues.put(columnName, o.toString());
    }

    @Override
    protected Object actualGetCursorValue(Cursor cursor, int index, Class<?> type) {
        return cursor.getString(index);
    }
}
